$(function () {
    var queryUrl = '../devmainbasehistory/list';
    var recordId = getQueryString('devMainBaseId');
    if(recordId){
        queryUrl += '?recordId=' + recordId
    }
    $("#jqGrid").Grid({
        url: queryUrl,
        multiselect: false,
        height: 350,
        rowNum: 10,
        rowList: [10, 20, 30],
        colModel: [
            {label: '操作人', name: 'operatorName', index: 'OPERATOR', width: 80,frozen: true},
            {label: '操作', name: 'actionType', index: 'ACTION_TYPE',frozen: true, width: 80,
                formatter: function (value) {
                    return sysEnums.DEV_MAIN_BASE_HISTORY_ACTION[value];
                }
            },
            {
                label: '操作时间', name: 'operateDate', index: 'OPERATE_DATE', width: 140,frozen: true, formatter: function (value) {
                    return transDate(value, 'yyyy-MM-dd hh:mm:ss');
                }
            },
            {label: '选项编码', name: 'code', index: 'CODE', width: 80},
            {label: '选项名称', name: 'name', index: 'NAME', width: 80},
            {label: '设备类型', name: 'devTypeName', index: 'DEV_TYPE', width: 120},
            {label: '供应厂家', name: 'devSupplyName', index: 'DEV_SUPPLY', width: 120},
            {label: '维护内容', name: 'checkContent', index: 'CHECK_CONTENT'},
            {label: '检查标准', name: 'checkSt', index: 'CHECK_ST', width: 150},
            {label: '物料需求', name: 'materialRequ', index: 'MATERIAL_REQU', width: 60,
                formatter: function (value) {
                    return value?value:'\\';
                }
            },
            {label: '方法手段', name: 'methodType', index: 'METHOD_TYPE', width: 150},
            {label: '生产时间', name: 'checkDatePrud', index: 'CHECK_DATE_PRUD', width: 80},
            {label: '非生产时间', name: 'checkDateUprud', index: 'CHECK_DATE_UPRUD', width: 80},
            {
                label: '实施频率', name: 'freRate', index: 'FRE_RATE', width: 80,
                formatter: function (value) {
                    return sysEnums.FRERATE[value];
                }
            },
            {label: '人次', name: 'perEv', index: 'PER_EV', width: 60},
            {
                label: '类型', name: 'mainType', index: 'MAIN_TYPE', width: 60,
                formatter: function (value) {
                    return sysEnums.MAINTENPLAN_TYPE[value];
                }
            },
            {
                label: '失效标识', name: 'lockFlag', index: 'LOCK_FLAG', width: 80,
                formatter: function (value) {
                    return sysEnums.SWITCH_FLAG[value];
                }
            },
            {label: 'id', name: 'id', index: 'ID', key: true, hidden: true}
        ],
        autoScroll: false,//当autoScroll和shrinkToFit均为false时，会出现行滚动条
        shrinkToFit: false,//是否列宽度自适应。true=适应 false=不适应
    });
    $("#jqGrid").jqGrid('setFrozenColumns');//设置冻结列生效
});

let vm = new Vue({
    el: '#rrapp',
    data: {

    },
    methods: {
        reload: function (event) {
            let page = $("#jqGrid").jqGrid('getGridParam', 'page');
            $("#jqGrid").jqGrid('setGridParam', {
                postData: {'name': vm.q.name},
                page: page
            }).trigger("reloadGrid");
            vm.handleReset('formValidate');
        },
        handleReset: function (name) {
            handleResetForm(this, name);
        }
    }
});